#include "http.h"
#include "ui_http.h"
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QDebug>
#include <QTextCodec>
#include "windows.h"

Http::Http(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::Http)
{
	ui->setupUi(this);
}

Http::~Http()
{
	delete ui;
}

void Http::on_pushButton_clicked()
{
	QNetworkAccessManager * manager = new QNetworkAccessManager(this);
//	qDebug() << http->supportedSchemes();
	QNetworkRequest request;
	request.setUrl(QUrl("http://181.214.233.174/"));
	QNetworkReply *reply = manager->get((request));
	connect(reply, &QNetworkReply::finished,[=](){
		QString data = QTextCodec::codecForName("utf-8")->toUnicode(reply->readAll());
		qDebug() << data;
		ui->textEdit->setText(data);
	});;

}
